# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html

import scrapy
from main import batch_run


##内容列表基类
class BaseListItem(scrapy.Item):
    # define the fields for your item here like:
    _id = scrapy.Field()  # 记录ID
    title = scrapy.Field()  ##标题
    url = scrapy.Field()  ##内容的url
    release_date = scrapy.Field(default="")  ##发布日期
    category = scrapy.Field(default="")  # 信息类别
    export = scrapy.Field(default="true")  # 是否导出默认为true，到处结果
    site_name = scrapy.Field(default="")  # 站点名称
    father_url = scrapy.Field(default="")  # 父链接URL
    fawenzihao = scrapy.Field(default="")  # 发文字号
    origin = scrapy.Field(default="")  # 来源


##教育数字化内容列表
class EollistItem(BaseListItem):
    # name = scrapy.Field()
    origin = scrapy.Field(default="")  # 来源
    brief = scrapy.Field(default="")  # 概要


##北京教委内容列表
class BjjwListItem(BaseListItem):
    fawenzihao = scrapy.Field(default="")  ##发文的字号
    pass


##教育部内容列表
class MoelistItem(BaseListItem):
    fawenzihao = scrapy.Field(default="")
    father_url = scrapy.Field(default="")
    pass


##内容详情基类
class BaseDetailItem(scrapy.Item):
    name = scrapy.Field(default="")  # 信息名称
    index = scrapy.Field(default="")  # 信息索引
    generation_date = scrapy.Field(default="")  # 生成日期
    issue_org = scrapy.Field(default="")  # 发文机构
    issue_number = scrapy.Field(default="")  # 发文字号
    category = scrapy.Field(default="")  # 信息类别
    overview = scrapy.Field(default="")  # 内容概述

    title = scrapy.Field(default="")  # 标题
    content = scrapy.Field(default="")  # 内容

    url = scrapy.Field(default="")  # 内容的URL

    affix_name = scrapy.Field(default=list)  # 附件名称
    affix_url = scrapy.Field(default=list)  # 附件URL
    affix_file_paths = scrapy.Field(default=list)  # 附件路径

    release_date = scrapy.Field(default="")  # 发布日期
    source = scrapy.Field(default="")  # 来源
    source_url = scrapy.Field(default="")  # 来源URL
    site_name = scrapy.Field(default="")  # 站点名称
    father_url = scrapy.Field(default="")  # 父链接URL
    brief = scrapy.Field(default="")  # 概要
    

##北京教委内容详情
class BjjwdetailItem(BaseDetailItem):
    info_valid = scrapy.Field(default="")  # 信息有效性

    interpretation_name = scrapy.Field(default="")  # 解读信息名
    interpretation_url = scrapy.Field(default="")  # 解读信息URL
    interpretation_content_title = scrapy.Field(default="")  # 解读信息内容的标题
    interpretation_content_date = scrapy.Field(default="")  # 解读信息内容的日期
    interpretation_content_source = scrapy.Field(default="")  # 解读信息来源
    interpretation_content = scrapy.Field(default="")  # 解读信息内容

    pass


##教育部内容详情
class MoedetailItem(BaseDetailItem):
    fawenzihao = scrapy.Field(default="")
    pass


class XinhuaAskItem(BaseListItem):
    # name = scrapy.Field()
    origin = scrapy.Field(default="")  # 来源
    brief = scrapy.Field(default="")  # 概要

    generation_date = scrapy.Field(default="")  # 生成日期
    issue_org = scrapy.Field(default="")  # 发文机构
    issue_number = scrapy.Field(default="")  # 发文字号

    content_title = scrapy.Field(default="")  # 标题
    content = scrapy.Field(default="")  # 内容

    affix_name = scrapy.Field(default=list)  # 附件名称
    affix_url = scrapy.Field(default=list)  # 附件URL
    affix_file_paths = scrapy.Field(default=list)  # 附件路径

    release_date = scrapy.Field(default="")  # 发布日期
    source = scrapy.Field(default="")  # 来源
    source_url = scrapy.Field(default="")  # 来源URL

    site_name = scrapy.Field(default="")  # 站点名称
    father_url = scrapy.Field(default="")  # 父链接URL
    category = scrapy.Field(default="")  # 信息类别



class RosListItem(scrapy.Item):
    name = scrapy.Field()
    url = scrapy.Field()  ##内容的url
    _date = scrapy.Field(default="")  # 生成日期
    branch = scrapy.Field(default="")  # 分支


class RosReposItem(scrapy.Item):
    name = scrapy.Field()
    url = scrapy.Field()  ##内容的url
    src_name = scrapy.Field(default="")  ##源码名称
    src_url = scrapy.Field(default="")  ##源码URL
    src_size = scrapy.Field(default="")  ##源码大小
    src_version = scrapy.Field(default="")  ##源码版本
    src_branch = scrapy.Field(default="")  ##源码分支
    src_release = scrapy.Field(default="")  ##源码发布日期
    
    ##源码下载地址
    affix_name = scrapy.Field(default=list)  # 附件名称
    affix_url = scrapy.Field(default=list)  # 附件URL
    affix_file_paths = scrapy.Field(default=list)  # 附件路径
    branch = scrapy.Field(default="")  # 分支